const {deployments,ethers} = require("hardhat");

// let deployer,user1;
module.exports = async (hre) => {
    const {deployments,ethers} = hre;
 
    const{deployer} = await getNamedAccounts();

    //2、部署nftAuction
    const factory = await ethers.getContractFactory("NftAuction");
    const proxy = await upgrades.deployProxy(factory, [],{ initializer: "initialize" });
    await proxy.waitForDeployment();
    console.log("NftAuction proxy address:", await proxy.getAddress());
    // console.log("NftAuction implementation address:", await upgrades.erc1967.getImplementationAddress(proxy.target));

    await deployments.save("proxyNftAuction",{
        abi: factory.interface.format("json"),
        address: proxy.target,
        args: [],
        contract: "NftAuction",
        from: deployer,
        log: true,
    })
}
module.exports.tags = ["nftAuctionV1"];